Skip to content

Conversation

souvlakias
Copy link
Contributor

@souvlakias souvlakias commented Sep 3, 2025

This PR resolves 2 issues:

  • The need to add extra dependencies due to the R8 detecting internal android classes as missing (Ref)

  • The need to pass --map-diagnostics error warn to r8 for the same reason.
    Now the gradle and mill configurations look quite close to each other

Motivation

In the thirdparty compose examples, classes such as androidx.windows.sidecar.** and androidx.windows.extensions.** are provided in runtime and R8 should not warn about them.
We found that AGP seems to append this common rules file in order to avoid such warnings.

Changes

Added this file in androidlib's resources and always pass it to R8.

mvn"androidx.emoji2:emoji2:1.5.0",
mvn"androidx.emoji2:emoji2-views:1.5.0",
mvn"androidx.emoji2:emoji2-bundled:1.5.0",
mvn"androidx.window:window:1.4.0",
Copy link
Contributor

@vaslabs vaslabs Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to completely remove this (window extensions)

androidReleaseSettings()
}

def androidR8ExtraRules: T[Seq[String]] = Task {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing this is a leftover

@vaslabs
Copy link
Contributor

vaslabs commented Sep 4, 2025

I'm suspecting the test apk must have a don't warn flag or even no minification or shrinking, but if this solves all the main apk packaging tasks to not need the error warn mapping, is a nice win


// Common Proguard Rules used by AGP
// Source: https://android.googlesource.com/platform/tools/base/+/refs/heads/studio-master-dev/build-system/gradle-core/src/main/resources/com/android/build/gradle/proguard-common.txt
def commonProguardFile: T[PathRef] = Task {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def commonProguardFile: T[PathRef] = Task {
def androidCommonProguardFile: T[PathRef] = Task {

@vaslabs vaslabs force-pushed the android-r8-no-warnings branch from ad5f161 to 72c2ad9 Compare September 15, 2025 11:28
@vaslabs vaslabs force-pushed the android-r8-no-warnings branch from 72c2ad9 to 9b840be Compare September 15, 2025 11:28
@vaslabs
Copy link
Contributor

vaslabs commented Sep 15, 2025

I have resolved the remaining issues and cleaned up some dependencies from the thirdparty compose samples, which I've also tested, probably androidtodo can be cleaned up from unnecessary dependencies too

@vaslabs
Copy link
Contributor

vaslabs commented Sep 15, 2025

this PR resolves 2 issues:

  • The need to add extra dependencies due to the R8 detecting internal android classes as missing
  • The need to pass --map-diagnostics error warn to r8 for the same reason.

Now the gradle and mill configurations look quite close to each other

@souvlakias when you get the chance, could you update the PR description please (+with the above) and mark the PR as ready when it passes on our copy

@souvlakias souvlakias marked this pull request as ready for review September 15, 2025 12:52
@vaslabs
Copy link
Contributor

vaslabs commented Sep 15, 2025

@lihaoyi @lefou this should be ready for review.

I think the failures are unrelated , bootstrap was just Exception in thread "main" java.lang.Exception: Mill server process already present . job's green in my copy

@vaslabs vaslabs mentioned this pull request Sep 15, 2025
2 tasks
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@lihaoyi lihaoyi merged commit 329b380 into com-lihaoyi:main Sep 16, 2025
33 checks passed
@lefou lefou added this to the 1.0.5 milestone Sep 16, 2025
@vaslabs
Copy link
Contributor

vaslabs commented Sep 16, 2025

it seems that this PR also fixes the slowness in androidtodo, there's 4 consecutive runs without a timeout, I'll keep an eye. but there were unneeded extra dependencies, which should make the example faster anyway

@vaslabs
Copy link
Contributor

vaslabs commented Sep 16, 2025

heh, spoken too soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants